package com.itfreer.demo.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

import com.itfreer.data.syn.base.DataSynPara;

/**
 * 同步配置
 */
@Configuration
public class DataSynConfiguration {

	/**
	 * 同步参数配置
	 * 
	 * @return
	 */
	@Bean
	public DataSynPara dataSynPara() {
		DataSynPara bean = new DataSynPara();
		return bean;
	}

	/**
	 * 定时任务
	 * 
	 * @return
	 */
	@Bean(name = "datasynScheduler")
	public SchedulerFactoryBean schedulerFactory() {
		SchedulerFactoryBean bean = new SchedulerFactoryBean();
		// 用于quartz集群,QuartzScheduler 启动时更新己存在的Job
		bean.setOverwriteExistingJobs(true);
		// 延时启动，应用启动1秒后
		bean.setStartupDelay(1);
		return bean;
	}
}